import { NgModule } from '@angular/core'
import { CommonModule } from '@angular/common'
import { HttpClientModule } from '@angular/common/http'
import { JwtModule } from '@auth0/angular-jwt'

export function tokenGetter() {
    return localStorage.getItem('authToken')
}

@NgModule({
    declarations: [],
    imports: [
        CommonModule,
        HttpClientModule,
        JwtModule.forRoot({
            config: {
                tokenGetter: tokenGetter,
                headerName: 'Authentication',
                authScheme: 'Bearer ',
                whitelistedDomains: [],
                blacklistedRoutes: ['api/login'],
                throwNoTokenError: false,
                skipWhenExpired: false,
            }
        })
    ],
    exports: [],
    providers: [],
})
export class AppJWTModule { }
